.class public Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;
.super Ljava/lang/Object;
.source "AsyncPromotionLoader.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$ImageCallback;
    }
.end annotation


# instance fields
.field private stringCache:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/ref/SoftReference",
            "<",
            "Lcom/bitauto/autoeasy/news/Object/Promotion;",
            ">;>;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 17
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 18
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;->stringCache:Ljava/util/HashMap;

    .line 19
    return-void
.end method

.method static synthetic access$0(Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;)Ljava/util/HashMap;
    .locals 1
    .parameter

    .prologue
    .line 15
    iget-object v0, p0, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;->stringCache:Ljava/util/HashMap;

    return-object v0
.end method

.method public static loadPromotionFromUrl(Ljava/lang/String;)Lcom/bitauto/autoeasy/news/Object/Promotion;
    .locals 4
    .parameter "url"

    .prologue
    .line 49
    new-instance v2, Lcom/bitauto/autoeasy/news/Object/PromotionParser;

    invoke-direct {v2, p0}, Lcom/bitauto/autoeasy/news/Object/PromotionParser;-><init>(Ljava/lang/String;)V

    .line 50
    .local v2, promotionParser:Lcom/bitauto/autoeasy/news/Object/PromotionParser;
    invoke-virtual {v2}, Lcom/bitauto/autoeasy/news/Object/PromotionParser;->Paser2Object()Ljava/util/ArrayList;

    move-result-object v0

    .line 51
    .local v0, list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/news/Object/Promotion;>;"
    if-eqz v0, :cond_0

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v3

    if-lez v3, :cond_0

    .line 52
    const/4 v3, 0x0

    invoke-virtual {v0, v3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/bitauto/autoeasy/news/Object/Promotion;

    .local v1, promo:Lcom/bitauto/autoeasy/news/Object/Promotion;
    move-object v3, v1

    .line 55
    .end local v1           #promo:Lcom/bitauto/autoeasy/news/Object/Promotion;
    :goto_0
    return-object v3

    :cond_0
    const/4 v3, 0x0

    goto :goto_0
.end method


# virtual methods
.method public loadDrawable(Ljava/lang/String;Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$ImageCallback;)Lcom/bitauto/autoeasy/news/Object/Promotion;
    .locals 4
    .parameter "imageUrl"
    .parameter "imageCallback"

    .prologue
    .line 22
    iget-object v3, p0, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;->stringCache:Ljava/util/HashMap;

    invoke-virtual {v3, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_0

    .line 23
    iget-object v3, p0, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;->stringCache:Ljava/util/HashMap;

    invoke-virtual {v3, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/ref/SoftReference;

    .line 24
    .local v1, softReference:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Lcom/bitauto/autoeasy/news/Object/Promotion;>;"
    invoke-virtual {v1}, Ljava/lang/ref/SoftReference;->get()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/bitauto/autoeasy/news/Object/Promotion;

    .line 25
    .local v2, str:Lcom/bitauto/autoeasy/news/Object/Promotion;
    if-eqz v2, :cond_0

    move-object v3, v2

    .line 44
    .end local v1           #softReference:Ljava/lang/ref/SoftReference;,"Ljava/lang/ref/SoftReference<Lcom/bitauto/autoeasy/news/Object/Promotion;>;"
    .end local v2           #str:Lcom/bitauto/autoeasy/news/Object/Promotion;
    :goto_0
    return-object v3

    .line 29
    :cond_0
    new-instance v0, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$1;

    invoke-direct {v0, p0, p2, p1}, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$1;-><init>(Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$ImageCallback;Ljava/lang/String;)V

    .line 35
    .local v0, handler:Landroid/os/Handler;
    new-instance v3, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$2;

    invoke-direct {v3, p0, p1, v0}, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$2;-><init>(Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader;Ljava/lang/String;Landroid/os/Handler;)V

    .line 43
    invoke-virtual {v3}, Lcom/bitauto/autoeasy/tool/AsyncPromotionLoader$2;->start()V

    .line 44
    const/4 v3, 0x0

    goto :goto_0
.end method
